/**
 * @author Christopher
 */

var timeCounter = 0;
var timeMultiplier = 1;
var clock = "on";
var hours = 0;
var minutes = 0;
var days = 0;
var hoursInDay = 8;

setInterval(function() {
	clockTimer();
}, 1000);

function clockTimer() {
	if (hours == hoursInDay)//put any code that should run daily here
	{
		//clock = "off";
		days = days + 1;
		notify("Day " + days + " has ended");
		hours = 0;

	} else {
		if (clock == "on") {
			timeCounter = timeCounter + (1 * timeMultiplier);
			var checkminutes = Math.floor(timeCounter / 60);
			if (checkminutes > minutes)//put any code that should run hourly here
			{
				minutes = minutes + 1;
				hours = hours + 1;
				notify(hours + " hour has passed");
				money = money - employeeCost();
				updateMoney();
			}
		}

	}

}

function toggleTime() {
	if (clock == "off") {
		clock = "on";
		//notify("Time is now On");
	} else {
		clock = "off";
		//notify("Time is now Off");
	}

	document.getElementById("time").value = "Clock is " + clock;
}

function setTimeMultiplier() {
	timeMultiplier = document.getElementById("timemultiplier").value;
	//notify(timeMultiplier);

}

function changeDayLength() {
	hoursInDay = document.getElementById("hoursinday").value;
	//notify(hoursInDay);
}
